import React, { Component } from 'react';
import { StyleSheet, View, Text, Image, Dimensions, Animated } from 'react-native';
import Resolution from '../tool/Resolution'
import Router from '../tool/Router'
var { width, height } = Dimensions.get('window');


export default class Start extends Component {
    constructor(props) {
        super(props)
        this.state = {
            isShowStart: true,
            o:new Animated.Value(1)
        }
    }

    componentWillMount() {
        setTimeout(this.animateFn.bind(this),100)
    }
    animateFn(){
        Animated.timing(                          
            this.state.o,                         
            {
              toValue: 0, 
              duration:1000,                       
            }
          ).start(()=> {this.setState({isShowStart:false})});    
    }
    render() {
        let { isShowStart } = this.state;
        return (
            <View style={{width:width,height:height}}>
                {isShowStart ? <Resolution.FixWidthView>
                    <Animated.View style={[styles.startPageBg, { justifyContent: 'center', alignItems: "center",opacity:this.state.o}]}>
                        <Image source={require('../img/logo.png')} style={{ width: 155, height: 165 }} />
                        <Text style={{ marginTop: 50, fontSize: 30, color: '#fff' }}>唯有暴富</Text>
                    </Animated.View>
                </Resolution.FixWidthView> : <Router/>}
            </View>
        )
    }
}

const styles = StyleSheet.create({
    startPageBg: {
        width: 750,
        height: height * 2,
        backgroundColor: '#ff1747',
    }
})